{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "Item-based-Collaborative-Recommender-System-using-KNN.ipynb",
      "provenance": [],
      "collapsed_sections": [
        "jVJu1rsTx0F3"
      ],
      "authorship_tag": "ABX9TyM1K937XEBtUiFWogHB4DtZ",
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/rposhala/Recommender-System-on-MovieLens-dataset/blob/main/Item_based_Collaborative_Recommender_System_using_KNN.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "bwSPLalV6Rca"
      },
      "source": [
        "import os\n",
        "import numpy as np\n",
        "import pandas as pd\n",
        "import matplotlib.pyplot as plt\n",
        "from scipy.sparse import csr_matrix\n",
        "from sklearn.neighbors import NearestNeighbors"
      ],
      "execution_count": 113,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "HKw5H628aSY9"
      },
      "source": [
        "DATASET_LINK='http://files.grouplens.org/datasets/movielens/ml-100k.zip'"
      ],
      "execution_count": 114,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "gavevc8waXW_",
        "outputId": "138b5e41-3605-4838-f1f7-9eac9315c9c6",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 67
        }
      },
      "source": [
        "!wget -nc http://files.grouplens.org/datasets/movielens/ml-100k.zip\n",
        "!unzip -n ml-100k.zip"
      ],
      "execution_count": 115,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "File ‘ml-100k.zip’ already there; not retrieving.\n",
            "\n",
            "Archive:  ml-100k.zip\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "d4WNkFXcauZ3"
      },
      "source": [
        "## Loading MovieLens dataset"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "3jZ7lU8RafYz"
      },
      "source": [
        "Loading u.info     -- The number of users, items, and ratings in the u data set."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "dEj5ZJQzaX-7",
        "outputId": "b73df5ec-cf04-491f-ad79-e2b9a8c26b16",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "overall_stats = pd.read_csv('ml-100k/u.info', header=None)\n",
        "print(\"Details of users, items and ratings involved in the loaded movielens dataset: \",list(overall_stats[0]))"
      ],
      "execution_count": 116,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Details of users, items and ratings involved in the loaded movielens dataset:  ['943 users', '1682 items', '100000 ratings']\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "aFzpbJ_Hap8V"
      },
      "source": [
        "Loading u.data     -- The full u data set, 100000 ratings by 943 users on 1682 items.\n",
        "\n",
        "---\n",
        "\n",
        "\n",
        "\n",
        "              Each user has rated at least 20 movies.  Users and items are\n",
        "              numbered consecutively from 1.  The data is randomly ordered. This is a tab separated list of \n",
        "\t         user id | item id | rating | timestamp. \n",
        "              The time stamps are unix seconds since 1/1/1970 UTC "
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "NXg9Sj7ralr4",
        "outputId": "0c8ac301-e92f-4682-df49-9c21c137dcd0",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 195
        }
      },
      "source": [
        "## same item id is same as movie id, item id column is renamed as movie id\n",
        "column_names1 = ['user id','movie id','rating','timestamp']\n",
        "dataset = pd.read_csv('ml-100k/u.data', sep='\\t',header=None,names=column_names1)\n",
        "dataset.head() "
      ],
      "execution_count": 117,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>user id</th>\n",
              "      <th>movie id</th>\n",
              "      <th>rating</th>\n",
              "      <th>timestamp</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>196</td>\n",
              "      <td>242</td>\n",
              "      <td>3</td>\n",
              "      <td>881250949</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>186</td>\n",
              "      <td>302</td>\n",
              "      <td>3</td>\n",
              "      <td>891717742</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>22</td>\n",
              "      <td>377</td>\n",
              "      <td>1</td>\n",
              "      <td>878887116</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>244</td>\n",
              "      <td>51</td>\n",
              "      <td>2</td>\n",
              "      <td>880606923</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>166</td>\n",
              "      <td>346</td>\n",
              "      <td>1</td>\n",
              "      <td>886397596</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "   user id  movie id  rating  timestamp\n",
              "0      196       242       3  881250949\n",
              "1      186       302       3  891717742\n",
              "2       22       377       1  878887116\n",
              "3      244        51       2  880606923\n",
              "4      166       346       1  886397596"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 117
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "M2lYi6toa9tA",
        "outputId": "01b6797c-12cf-479f-fc6e-1889e088e8af",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "len(dataset), max(dataset['movie id']),min(dataset['movie id'])"
      ],
      "execution_count": 118,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "(100000, 1682, 1)"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 118
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "9C9qVRfcbE0k"
      },
      "source": [
        "Loading u.item     -- Information about the items (movies); this is a tab separated\n",
        "\n",
        "              list of\n",
        "              movie id | movie title | release date | video release date |\n",
        "              IMDb URL | unknown | Action | Adventure | Animation |\n",
        "              Children's | Comedy | Crime | Documentary | Drama | Fantasy |\n",
        "              Film-Noir | Horror | Musical | Mystery | Romance | Sci-Fi |\n",
        "              Thriller | War | Western |\n",
        "              The last 19 fields are the genres, a 1 indicates the movie\n",
        "              is of that genre, a 0 indicates it is not; movies can be in\n",
        "              several genres at once.\n",
        "              The movie ids are the ones used in the u.data data set.\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ZaMNuf9fbA0V",
        "outputId": "d0d0ced1-9bfb-404a-d0d4-e168cddc6ea0",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 420
        }
      },
      "source": [
        "d = 'movie id | movie title | release date | video release date | IMDb URL | unknown | Action | Adventure | Animation | Children | Comedy | Crime | Documentary | Drama | Fantasy | Film-Noir | Horror | Musical | Mystery | Romance | Sci-Fi | Thriller | War | Western'\n",
        "column_names2 = d.split(' | ')\n",
        "column_names2"
      ],
      "execution_count": 119,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "['movie id',\n",
              " 'movie title',\n",
              " 'release date',\n",
              " 'video release date',\n",
              " 'IMDb URL',\n",
              " 'unknown',\n",
              " 'Action',\n",
              " 'Adventure',\n",
              " 'Animation',\n",
              " 'Children',\n",
              " 'Comedy',\n",
              " 'Crime',\n",
              " 'Documentary',\n",
              " 'Drama',\n",
              " 'Fantasy',\n",
              " 'Film-Noir',\n",
              " 'Horror',\n",
              " 'Musical',\n",
              " 'Mystery',\n",
              " 'Romance',\n",
              " 'Sci-Fi',\n",
              " 'Thriller',\n",
              " 'War',\n",
              " 'Western']"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 119
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Cv_sboAHbMp7",
        "outputId": "db4cb56c-afa3-4ad4-bef6-fd6937eaddf1",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 758
        }
      },
      "source": [
        "items_dataset = pd.read_csv('ml-100k/u.item', sep='|',header=None,names=column_names2,encoding='latin-1')\n",
        "items_dataset"
      ],
      "execution_count": 120,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>movie id</th>\n",
              "      <th>movie title</th>\n",
              "      <th>release date</th>\n",
              "      <th>video release date</th>\n",
              "      <th>IMDb URL</th>\n",
              "      <th>unknown</th>\n",
              "      <th>Action</th>\n",
              "      <th>Adventure</th>\n",
              "      <th>Animation</th>\n",
              "      <th>Children</th>\n",
              "      <th>Comedy</th>\n",
              "      <th>Crime</th>\n",
              "      <th>Documentary</th>\n",
              "      <th>Drama</th>\n",
              "      <th>Fantasy</th>\n",
              "      <th>Film-Noir</th>\n",
              "      <th>Horror</th>\n",
              "      <th>Musical</th>\n",
              "      <th>Mystery</th>\n",
              "      <th>Romance</th>\n",
              "      <th>Sci-Fi</th>\n",
              "      <th>Thriller</th>\n",
              "      <th>War</th>\n",
              "      <th>Western</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1</td>\n",
              "      <td>Toy Story (1995)</td>\n",
              "      <td>01-Jan-1995</td>\n",
              "      <td>NaN</td>\n",
              "      <td>http://us.imdb.com/M/title-exact?Toy%20Story%2...</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>2</td>\n",
              "      <td>GoldenEye (1995)</td>\n",
              "      <td>01-Jan-1995</td>\n",
              "      <td>NaN</td>\n",
              "      <td>http://us.imdb.com/M/title-exact?GoldenEye%20(...</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>3</td>\n",
              "      <td>Four Rooms (1995)</td>\n",
              "      <td>01-Jan-1995</td>\n",
              "      <td>NaN</td>\n",
              "      <td>http://us.imdb.com/M/title-exact?Four%20Rooms%...</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>4</td>\n",
              "      <td>Get Shorty (1995)</td>\n",
              "      <td>01-Jan-1995</td>\n",
              "      <td>NaN</td>\n",
              "      <td>http://us.imdb.com/M/title-exact?Get%20Shorty%...</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>5</td>\n",
              "      <td>Copycat (1995)</td>\n",
              "      <td>01-Jan-1995</td>\n",
              "      <td>NaN</td>\n",
              "      <td>http://us.imdb.com/M/title-exact?Copycat%20(1995)</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1677</th>\n",
              "      <td>1678</td>\n",
              "      <td>Mat' i syn (1997)</td>\n",
              "      <td>06-Feb-1998</td>\n",
              "      <td>NaN</td>\n",
              "      <td>http://us.imdb.com/M/title-exact?Mat%27+i+syn+...</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1678</th>\n",
              "      <td>1679</td>\n",
              "      <td>B. Monkey (1998)</td>\n",
              "      <td>06-Feb-1998</td>\n",
              "      <td>NaN</td>\n",
              "      <td>http://us.imdb.com/M/title-exact?B%2E+Monkey+(...</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1679</th>\n",
              "      <td>1680</td>\n",
              "      <td>Sliding Doors (1998)</td>\n",
              "      <td>01-Jan-1998</td>\n",
              "      <td>NaN</td>\n",
              "      <td>http://us.imdb.com/Title?Sliding+Doors+(1998)</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1680</th>\n",
              "      <td>1681</td>\n",
              "      <td>You So Crazy (1994)</td>\n",
              "      <td>01-Jan-1994</td>\n",
              "      <td>NaN</td>\n",
              "      <td>http://us.imdb.com/M/title-exact?You%20So%20Cr...</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1681</th>\n",
              "      <td>1682</td>\n",
              "      <td>Scream of Stone (Schrei aus Stein) (1991)</td>\n",
              "      <td>08-Mar-1996</td>\n",
              "      <td>NaN</td>\n",
              "      <td>http://us.imdb.com/M/title-exact?Schrei%20aus%...</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>1682 rows × 24 columns</p>\n",
              "</div>"
            ],
            "text/plain": [
              "      movie id                                movie title  ... War  Western\n",
              "0            1                           Toy Story (1995)  ...   0        0\n",
              "1            2                           GoldenEye (1995)  ...   0        0\n",
              "2            3                          Four Rooms (1995)  ...   0        0\n",
              "3            4                          Get Shorty (1995)  ...   0        0\n",
              "4            5                             Copycat (1995)  ...   0        0\n",
              "...        ...                                        ...  ...  ..      ...\n",
              "1677      1678                          Mat' i syn (1997)  ...   0        0\n",
              "1678      1679                           B. Monkey (1998)  ...   0        0\n",
              "1679      1680                       Sliding Doors (1998)  ...   0        0\n",
              "1680      1681                        You So Crazy (1994)  ...   0        0\n",
              "1681      1682  Scream of Stone (Schrei aus Stein) (1991)  ...   0        0\n",
              "\n",
              "[1682 rows x 24 columns]"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 120
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "VFhUx9zsbQpD",
        "outputId": "d6bf0a5a-4dd8-4923-9b91-c50a04bef417",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 195
        }
      },
      "source": [
        "movie_dataset = items_dataset[['movie id','movie title']]\n",
        "movie_dataset.head()"
      ],
      "execution_count": 121,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>movie id</th>\n",
              "      <th>movie title</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1</td>\n",
              "      <td>Toy Story (1995)</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>2</td>\n",
              "      <td>GoldenEye (1995)</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>3</td>\n",
              "      <td>Four Rooms (1995)</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>4</td>\n",
              "      <td>Get Shorty (1995)</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>5</td>\n",
              "      <td>Copycat (1995)</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "   movie id        movie title\n",
              "0         1   Toy Story (1995)\n",
              "1         2   GoldenEye (1995)\n",
              "2         3  Four Rooms (1995)\n",
              "3         4  Get Shorty (1995)\n",
              "4         5     Copycat (1995)"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 121
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Wr2cmp5impC7"
      },
      "source": [
        "Looking at length of original items_dataset and length of unique combination of rows in items_dataset after removing movie id column"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "iIwj68LWGeQX",
        "outputId": "1df25549-276e-49fc-950f-139f79f493e2",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "## looking at length of original items_dataset and length of unique combination of rows in items_dataset after removing movie id column\n",
        "len(items_dataset.groupby(by=column_names2[1:])),len(items_dataset)"
      ],
      "execution_count": 122,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "(1664, 1682)"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 122
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "AfBNIWO7mqjc"
      },
      "source": [
        "We can see there are 18 extra movie id's for already mapped movie title and the same duplicate movie id is assigned to the user in the user-item dataset."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "nwdvxUdkbiPK"
      },
      "source": [
        "## Merging required datasets"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "-fKazhqFbcAq",
        "outputId": "636990d0-c78b-4b1e-f269-dec12c317de3",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 195
        }
      },
      "source": [
        "merged_dataset = pd.merge(dataset, movie_dataset, how='inner', on='movie id')\n",
        "merged_dataset.head()"
      ],
      "execution_count": 123,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>user id</th>\n",
              "      <th>movie id</th>\n",
              "      <th>rating</th>\n",
              "      <th>timestamp</th>\n",
              "      <th>movie title</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>196</td>\n",
              "      <td>242</td>\n",
              "      <td>3</td>\n",
              "      <td>881250949</td>\n",
              "      <td>Kolya (1996)</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>63</td>\n",
              "      <td>242</td>\n",
              "      <td>3</td>\n",
              "      <td>875747190</td>\n",
              "      <td>Kolya (1996)</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>226</td>\n",
              "      <td>242</td>\n",
              "      <td>5</td>\n",
              "      <td>883888671</td>\n",
              "      <td>Kolya (1996)</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>154</td>\n",
              "      <td>242</td>\n",
              "      <td>3</td>\n",
              "      <td>879138235</td>\n",
              "      <td>Kolya (1996)</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>306</td>\n",
              "      <td>242</td>\n",
              "      <td>5</td>\n",
              "      <td>876503793</td>\n",
              "      <td>Kolya (1996)</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "   user id  movie id  rating  timestamp   movie title\n",
              "0      196       242       3  881250949  Kolya (1996)\n",
              "1       63       242       3  875747190  Kolya (1996)\n",
              "2      226       242       5  883888671  Kolya (1996)\n",
              "3      154       242       3  879138235  Kolya (1996)\n",
              "4      306       242       5  876503793  Kolya (1996)"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 123
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ELmLkEQBnxv1"
      },
      "source": [
        "A dataset is created from the existing merged dataset by grouping the unique user id and movie title combination and the ratings by a user to the same movie in different instances (timestamps) are averaged and stored in the new dataset."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "zd2jR0cFouee"
      },
      "source": [
        "Example of a multiple rating scenario by an user to a specific movie:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "HQ6owSOikYMq",
        "outputId": "496ac596-719b-4ad3-bf8f-79cae6e0e88d",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 106
        }
      },
      "source": [
        "merged_dataset[(merged_dataset['movie title'] == 'Chasing Amy (1997)') & (merged_dataset['user id'] == 894)]"
      ],
      "execution_count": 124,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>user id</th>\n",
              "      <th>movie id</th>\n",
              "      <th>rating</th>\n",
              "      <th>timestamp</th>\n",
              "      <th>movie title</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>4800</th>\n",
              "      <td>894</td>\n",
              "      <td>246</td>\n",
              "      <td>4</td>\n",
              "      <td>882404137</td>\n",
              "      <td>Chasing Amy (1997)</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>22340</th>\n",
              "      <td>894</td>\n",
              "      <td>268</td>\n",
              "      <td>3</td>\n",
              "      <td>879896041</td>\n",
              "      <td>Chasing Amy (1997)</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "       user id  movie id  rating  timestamp         movie title\n",
              "4800       894       246       4  882404137  Chasing Amy (1997)\n",
              "22340      894       268       3  879896041  Chasing Amy (1997)"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 124
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "p5XS_3dPhCVb",
        "outputId": "f122409a-556b-4dd7-eeb0-1c98b280c81d",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 195
        }
      },
      "source": [
        "refined_dataset = merged_dataset.groupby(by=['user id','movie title'], as_index=False).agg({\"rating\":\"mean\"})\n",
        "\n",
        "refined_dataset.head()"
      ],
      "execution_count": 125,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>user id</th>\n",
              "      <th>movie title</th>\n",
              "      <th>rating</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1</td>\n",
              "      <td>101 Dalmatians (1996)</td>\n",
              "      <td>2.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>1</td>\n",
              "      <td>12 Angry Men (1957)</td>\n",
              "      <td>5.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>1</td>\n",
              "      <td>20,000 Leagues Under the Sea (1954)</td>\n",
              "      <td>3.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>1</td>\n",
              "      <td>2001: A Space Odyssey (1968)</td>\n",
              "      <td>4.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>1</td>\n",
              "      <td>Abyss, The (1989)</td>\n",
              "      <td>3.0</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "   user id                          movie title  rating\n",
              "0        1                101 Dalmatians (1996)     2.0\n",
              "1        1                  12 Angry Men (1957)     5.0\n",
              "2        1  20,000 Leagues Under the Sea (1954)     3.0\n",
              "3        1         2001: A Space Odyssey (1968)     4.0\n",
              "4        1                    Abyss, The (1989)     3.0"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 125
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "W_HNZ2j9dP5O"
      },
      "source": [
        "## Exploratory data analysis\n",
        "\n",
        "*   Plot the counts of each rating\n",
        "*   Plot rating frequency of each movie"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "i_cInoHOrk4o"
      },
      "source": [
        "**Plot the counts of each rating**\n",
        "\n",
        "we first need to get the counts of each rating from ratings data"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "qkoNLoyabl42",
        "outputId": "e71b61e0-1106-4cc1-f4af-b4cbce4d6400",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 50
        }
      },
      "source": [
        "# num_users = len(refined_dataset.rating.unique())\n",
        "# num_items = len(refined_dataset.movieId.unique())\n",
        "num_users = len(refined_dataset['user id'].value_counts())\n",
        "num_items = len(refined_dataset['movie title'].value_counts())\n",
        "print('Unique number of users in the dataset: {}'.format(num_users))\n",
        "print('Unique number of movies in the dataset: {}'.format(num_items))\n"
      ],
      "execution_count": 126,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Unique number of users in the dataset: 943\n",
            "Unique number of movies in the dataset: 1664\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Ea3fORd-r24Z",
        "outputId": "1aed76ea-4851-436e-943a-1eb45473905b",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 343
        }
      },
      "source": [
        "rating_count_df = pd.DataFrame(refined_dataset.groupby(['rating']).size(), columns=['count'])\n",
        "rating_count_df"
      ],
      "execution_count": 127,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>count</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>rating</th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>1.0</th>\n",
              "      <td>6083</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1.5</th>\n",
              "      <td>3</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2.0</th>\n",
              "      <td>11334</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2.5</th>\n",
              "      <td>6</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3.0</th>\n",
              "      <td>27060</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3.5</th>\n",
              "      <td>19</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4.0</th>\n",
              "      <td>34042</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4.5</th>\n",
              "      <td>16</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5.0</th>\n",
              "      <td>21130</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "        count\n",
              "rating       \n",
              "1.0      6083\n",
              "1.5         3\n",
              "2.0     11334\n",
              "2.5         6\n",
              "3.0     27060\n",
              "3.5        19\n",
              "4.0     34042\n",
              "4.5        16\n",
              "5.0     21130"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 127
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "BbcBMiiC0GIl",
        "outputId": "b777075a-17f1-44a5-d239-808d729274a4",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 539
        }
      },
      "source": [
        "ax = rating_count_df.reset_index().rename(columns={'index': 'rating score'}).plot('rating','count', 'bar',\n",
        "    figsize=(12, 8),\n",
        "    title='Count for Each Rating Score',\n",
        "    fontsize=12)\n",
        "\n",
        "ax.set_xlabel(\"movie rating score\")\n",
        "ax.set_ylabel(\"number of ratings\")"
      ],
      "execution_count": 128,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "Text(0, 0.5, 'number of ratings')"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 128
        },
        {
          "output_type": "display_data",
          "data": {
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAuYAAAH5CAYAAADN8fuAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3de7hdVX3v//eHBImSIFcRD0IU0WgsoRrFWlERe8R6PaIVQQteoF5pa23rUVSqWC9oS2nVChUBpRTpDyyKxSMKKnhpg5rQCGpVohTQEGNIgoTb9/fHmhsX253slcvaayT7/Xqe9TDXHHPM9Z0zS/dnjz3mnKkqJEmSJI3WdqMuQJIkSZLBXJIkSWqCwVySJElqgMFckiRJaoDBXJIkSWqAwV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GMffNF2/R/V333mdt0f1tilNOOYWXvvSl3O9+99vsfU317RJnMvEc87FQvF1VraQ35WVBX/sCYGm3vLS/LcmO3T6XDtBXkiRJ08zZZ5/NAQccwIIFC3jZy17Gddddx9Oe9jQOOOAADj30UH7yk58AcMwxx/Cv//qv9/SbPbs3GePyyy/nqU99Ki984QuZN28eRx11FFXFqaeeyg033MAhhxzCIYccstl1Di2YJ3lAkiOSzE4yI8kzgJcAX0xyUJJHJNkuyW7AqcDlVTU2BeVs4IQku3QXdR4LnNm1XQg8OsnhSWYBbweWVNW1A/SVJEnSNLJ06VJOOukkvvSlL7F48WL+7u/+jje84Q0cffTRLFmyhKOOOorjjz9+0v18+9vf5pRTTuG73/0uP/rRj7jyyis5/vjjedCDHsRll13GZZddttm1DnPEvIDXANcDK4EPAH9SVRcBDwUuoTfF5L/ozTt/SV/fd9C7oHMZ8GXg5LHbHVbVcuBw4N3dfg8CjhikryRJkqaXL33pS7zoRS9i9913B2DXXXfl61//OkceeSQAL3vZy7jiiism3c/jH/949t57b7bbbjsOPPBArrvuui1e69DmmHcB+inraTsXOHcDfdcBr+heE7VfCsxbT9sG+0qSJEkTmTlzJnfffTcAd999N7fffvs9bTvssMM9yzNmzODOOyd6FM/mmeo55pIkSdKUedrTnsb555/PihW951v+4he/4IlPfCL/8i//AsA555zDwQcfDMDcuXO56qqrALjooou44447Jt3/nDlzWL16wvuMbLQpuSuLJEmSNArz58/nrW99K095ylOYMWMGv/3bv83f//3f8/KXv5yTTz6ZPfbYg49//OMAHHvssTzvec9jwYIFHHbYYey4446T7v+4447jsMMOu2eu+eZIlXcJhN7tEhctWjT5hpIkSRrINddcwyMf+chRlzEyEx1/kquqauFE2zuVRZIkSWqAwVySJElqgMFckiRJaoAXf0qSpM2ypR+zviW08Kh29VQVSUZdxpTblOs4HTGXJEnSUMyaNYsVK1ZsUkjdmlUVK1asYNasWRvVzxFzSZIkDcXee+/N9ddfz/Lly0ddypSbNWsWe++990b1MZhLkiRpKLbffnse8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FnGcol6d4cMZckSZIa4BxzSZIkqQEGc0mSJKkBBnNJkiSpAQZzSZIkqQEGc0mSJKkBBnNJkiSpAf8/uLklLdH5t3IAAAAASUVORK5CYII=\n",
            "text/plain": [
              "<Figure size 864x576 with 1 Axes>"
            ]
          },
          "metadata": {
            "tags": [],
            "needs_background": "light"
          }
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "zM7NoOXG1vYU"
      },
      "source": [
        "We can see that number of 1.5, 2.5, 3.5, 4.5 ratings by the users are comparitively negligible."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "cXYlt0OFxP1z"
      },
      "source": [
        "Ratings for the movies not seen by a user is by default considered as 0. Lets calculate and add it to the existing dataframe."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "lgyPInMAwQAv",
        "outputId": "10191306-986d-469f-dd46-5be593208c7f",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "total_count = num_items * num_users\n",
        "zero_count = total_count-refined_dataset.shape[0]\n",
        "zero_count"
      ],
      "execution_count": 129,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "1469459"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 129
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "avyj8_8ewjA_",
        "outputId": "8e6b1763-1ea6-45ed-e86c-8ec1216e1fe4",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 343
        }
      },
      "source": [
        "# append counts of zero rating to df_ratings_cnt\n",
        "rating_count_df = rating_count_df.append(\n",
        "    pd.DataFrame({'count': zero_count}, index=[0.0]),\n",
        "    verify_integrity=True,\n",
        ").sort_index()\n",
        "rating_count_df"
      ],
      "execution_count": 130,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>count</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0.0</th>\n",
              "      <td>1469459</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1.0</th>\n",
              "      <td>6083</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1.5</th>\n",
              "      <td>3</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2.0</th>\n",
              "      <td>11334</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2.5</th>\n",
              "      <td>6</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3.0</th>\n",
              "      <td>27060</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3.5</th>\n",
              "      <td>19</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4.0</th>\n",
              "      <td>34042</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4.5</th>\n",
              "      <td>16</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5.0</th>\n",
              "      <td>21130</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "       count\n",
              "0.0  1469459\n",
              "1.0     6083\n",
              "1.5        3\n",
              "2.0    11334\n",
              "2.5        6\n",
              "3.0    27060\n",
              "3.5       19\n",
              "4.0    34042\n",
              "4.5       16\n",
              "5.0    21130"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 130
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Ofd8LQcVxvYA"
      },
      "source": [
        "Number of times no rating was given (forged as 0 in this case) is a lot more than other ratings."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "f7ngnrerysBV"
      },
      "source": [
        "So let's take log transform for count values and then we can plot them to compare"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ACZx4jhKxtGH",
        "outputId": "43772624-dd68-4665-dab7-776df6fb0200",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 343
        }
      },
      "source": [
        "# add log count\n",
        "rating_count_df['log_count'] = np.log(rating_count_df['count'])\n",
        "rating_count_df"
      ],
      "execution_count": 131,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>count</th>\n",
              "      <th>log_count</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0.0</th>\n",
              "      <td>1469459</td>\n",
              "      <td>14.200405</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1.0</th>\n",
              "      <td>6083</td>\n",
              "      <td>8.713253</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1.5</th>\n",
              "      <td>3</td>\n",
              "      <td>1.098612</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2.0</th>\n",
              "      <td>11334</td>\n",
              "      <td>9.335562</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2.5</th>\n",
              "      <td>6</td>\n",
              "      <td>1.791759</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3.0</th>\n",
              "      <td>27060</td>\n",
              "      <td>10.205812</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3.5</th>\n",
              "      <td>19</td>\n",
              "      <td>2.944439</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4.0</th>\n",
              "      <td>34042</td>\n",
              "      <td>10.435350</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4.5</th>\n",
              "      <td>16</td>\n",
              "      <td>2.772589</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5.0</th>\n",
              "      <td>21130</td>\n",
              "      <td>9.958449</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "       count  log_count\n",
              "0.0  1469459  14.200405\n",
              "1.0     6083   8.713253\n",
              "1.5        3   1.098612\n",
              "2.0    11334   9.335562\n",
              "2.5        6   1.791759\n",
              "3.0    27060  10.205812\n",
              "3.5       19   2.944439\n",
              "4.0    34042  10.435350\n",
              "4.5       16   2.772589\n",
              "5.0    21130   9.958449"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 131
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "J2LE9usIy1Mz",
        "outputId": "b0bd7926-7d36-4e9d-ec5b-f9f090ef228d",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 343
        }
      },
      "source": [
        "rating_count_df = rating_count_df.reset_index().rename(columns={'index': 'rating score'})\n",
        "rating_count_df"
      ],
      "execution_count": 132,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>rating score</th>\n",
              "      <th>count</th>\n",
              "      <th>log_count</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>0.0</td>\n",
              "      <td>1469459</td>\n",
              "      <td>14.200405</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>1.0</td>\n",
              "      <td>6083</td>\n",
              "      <td>8.713253</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>1.5</td>\n",
              "      <td>3</td>\n",
              "      <td>1.098612</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>2.0</td>\n",
              "      <td>11334</td>\n",
              "      <td>9.335562</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>2.5</td>\n",
              "      <td>6</td>\n",
              "      <td>1.791759</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>3.0</td>\n",
              "      <td>27060</td>\n",
              "      <td>10.205812</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>3.5</td>\n",
              "      <td>19</td>\n",
              "      <td>2.944439</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>7</th>\n",
              "      <td>4.0</td>\n",
              "      <td>34042</td>\n",
              "      <td>10.435350</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>8</th>\n",
              "      <td>4.5</td>\n",
              "      <td>16</td>\n",
              "      <td>2.772589</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>9</th>\n",
              "      <td>5.0</td>\n",
              "      <td>21130</td>\n",
              "      <td>9.958449</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "   rating score    count  log_count\n",
              "0           0.0  1469459  14.200405\n",
              "1           1.0     6083   8.713253\n",
              "2           1.5        3   1.098612\n",
              "3           2.0    11334   9.335562\n",
              "4           2.5        6   1.791759\n",
              "5           3.0    27060  10.205812\n",
              "6           3.5       19   2.944439\n",
              "7           4.0    34042  10.435350\n",
              "8           4.5       16   2.772589\n",
              "9           5.0    21130   9.958449"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 132
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "vb5wAmR4zg7s",
        "outputId": "8b822e7a-4e99-460e-e78f-2e4fa97bf9af",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 539
        }
      },
      "source": [
        "ax = rating_count_df.plot('rating score', 'log_count', 'bar', figsize=(12, 8),\n",
        "    title='Count for Each Rating Score (in Log Scale)',\n",
        "    logy=True,\n",
        "    fontsize=12,)\n",
        "\n",
        "ax.set_xlabel(\"movie rating score\")\n",
        "ax.set_ylabel(\"number of ratings\")"
      ],
      "execution_count": 133,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "Text(0, 0.5, 'number of ratings')"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 133
        },
        {
          "output_type": "display_data",
          "data": {
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAtcAAAH5CAYAAABKwBKGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3debhkVXkv4N8HDTQKtOKAA2KjqIBBEAGNiEMciAoOUYNjnCJXcEjilYSrmBivJmhiot6YGIwGNYSLGiQgxkSMBhlUUBkuDjjQKkoYWmkGRYRe94+9m1Pdnu6ubvY51dXnfZ+nHmoPteurdfahfr3O2mtXay0AAMDtt8WkCwAAgM2FcA0AAAMRrgEAYCDCNQAADES4BgCAgQjXAAAwEOEamApV9daquqaq/nvStaxNVb25qv5p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XpBvnuzzdz/Gk9MNRZnFdut77H6QbTvCOJEe01lb9nF+UblzvN5NclW6Melp3MeqbkvxLuuB4/3QXts6qtXZ+klekuwj0p+kuvHvJOj7DcUlesEbP8e3xvCQ/H3l8d13nWn++/Va6oTvX9vt9Mmtvx58leWe68+aadOOvn9Va+14/ZOTQdL3KP0hyebqpGZPuQuB90/3l4vQkJ6/jM7w73YW0/1FV16e7iHL0H38vSBfAgTlSqw8VA2Ahqu6mMN9srf3JpGvZEFX1z+kuODxlvTvPg6r6UpL3tdb+cdK1rKmq7p5u6sKHttbWNU4duB2Ea4AFqKr2T/KTJJcleVK6v1D8emvtaxMtbMpU1WPSzWhyTWZ6he/XD5cBFiCzhQAsTPdIN7zgLumGIBwhWG+UB6Ubl33HJN9L8mzBGhY2PdcAADAQFzQCAMBAhGsAABjIZjPm+q53vWtbunTppMsAAGAz95WvfOWa1trdZtu22YTrpUuX5vzzz590GQAAbOaqaq03YjIsBAAABiJcAwDAQIRrAAAYyGYz5hoAYKH75S9/mcsvvzw33eQO90NYvHhxdt5552y11VZjv0a4BgDYTFx++eXZfvvts3Tp0lTVpMuZaq21LF++PJdffnl23XXXsV9nWAgAwGbipptuyl3uchfBegBVlbvc5S4b/FcA4RoAYDMiWA9nY9pSuAYAgIEYcw0AsJlaevTpgx5v2bFPXe8+2223XW644YZB33cunXLKKXngAx+YPffcc5Dj6bkGAGDBOuWUU/L1r399sOMJ1wAADK61lqOOOiq/9mu/lr322isnnXRSkmTlypU58sgjs/vuu+eJT3xinvKUp+TjH//4Wo9z3nnn5ZGPfGT23nvvHHDAAbn++utz00035aUvfWn22muvPPShD83nPve5JMnxxx+fV7/61be99pBDDsnnP//5JF2P+hvf+MbsvffeecQjHpErr7wy55xzTk499dQcddRR2WefffLd7373dn9uw0IAABjcySefnAsuuCAXXnhhrrnmmuy///559KMfnbPPPjvLli3L17/+9Vx11VXZY4898rKXvWzWY9x888057LDDctJJJ2X//ffPddddl2233Tbvfve7U1W5+OKL881vfjNPetKTcumll66znhtvvDGPeMQj8ra3vS1/+Id/mPe///055phj8rSnPS2HHHJInv3sZw/yufVcAwAwuLPOOivPe97zsuWWW2annXbKYx7zmJx33nk566yz8pznPCdbbLFF7nGPe+Rxj3vcWo/xrW99K/e85z2z//77J0l22GGHLFq0KGeddVZe+MIXJkl233333Pe+911vuN56661zyCGHJEke9rCHZdmyZcN80DUI1wAAbBYWLVqUlStX3rY8Okf1VlttddvUeltuuWVuueWWOalBuAYAYHAHHXRQTjrppNx66625+uqrc+aZZ+aAAw7IgQcemH/5l3/JypUrc+WVV942Jno2D3rQg3LFFVfkvPPOS5Jcf/31ueWWW3LQQQflhBNOSJJceuml+cEPfpAHPehBWbp0aS644IKsXLkyP/zhD/PlL395vXVuv/32uf766wf5zIkx1wAAm61xps6bK8985jNz7rnnZu+9905V5R3veEfucY975FnPelY++9nPZs8998x97nOf7LvvvlmyZMmsx9h6661z0kkn5TWveU1+/vOfZ9ttt80ZZ5yRI488MkcccUT22muvLFq0KMcff3y22WabHHjggdl1112z5557Zo899si+++673jqf+9zn5hWveEXe85735OMf/3juf//7367PXa2123WATcV+++3Xzj///EmXAQAwMd/4xjeyxx57TLqM9brhhhuy3XbbZfny5TnggANy9tln5x73uMeky5rVbG1aVV9pre032/56rgEAmFeHHHJIrr322tx8881505vetMkG640hXI8Y+i5GG2OSf74BAJgPs42zfuYzn5nLLrtstXVvf/vbc/DBB89TVcMQrgEAmLhPfOITky5hEGYLAQDYjGwu19NtCjamLYVrAIDNxOLFi7N8+XIBewCttSxfvjyLFy/eoNcZFgIAsJnYeeedc/nll+fqq6+edCmbhcWLF2fnnXfeoNcI1wAAm4mtttoqu+6666TLWNAMCwEAgIEI1wAAMBDhGgAABiJcAwDAQIRrAAAYiHANAAADEa4BAGAgwjUAAAxEuAYAgIEI1wAAMBDhGgAABiJcAwDAQIRrAAAYiHANAAADEa4BAGAgwjUAAAxEuAYAgIEI1wAAMBDhGgAABiJcAwDAQIRrAAAYiHANAAADEa4BAG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ll1bVbv1LX5Tkv2Y55BeTHLhqv6q6Y1WN2wMPMO+Ea4D58+YkD6uqi9JdVPjikW0nJXlh1hgSMuIFSV5eVRcmuSTJ08d4v79N8uL+Nbtnpjf4oiS39hcd/sE4hbfWzktyav/af0tycZIVs+z6F/0Fiv8vyTlJLkzyD0l+kOSivpbn98NLXppuqMvF6Xr43zfL+16d5CVJTuzb7dz+swBskkzFB8BYqmq71toNVXWHJGcmOby19tVJ1wWwKTHmGoBxHVdVeyZZnORDgjXAr9JzDQAAAzHmGgAABiJcAwDAQIRrAAAYiHANAAADEa4BAGAgwjUAAAzk/wMTBMoPutQUjwAAAABJRU5ErkJggg==\n",
            "text/plain": [
              "<Figure size 864x576 with 1 Axes>"
            ]
          },
          "metadata": {
            "tags": [],
            "needs_background": "light"
          }
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "J5oRl9LZ2KiW"
      },
      "source": [
        "We have already observed from the before bar plot that ratings 3 and 4 are given in more numbers by the users. Even the above graph suggests the same.\n",
        "\n",
        " Take away from this plot is by the number of missing ratings, we can estimate the level of sparsity in the matrix we are going to form. "
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ezYrpsCM2LC7"
      },
      "source": [
        "**Plot rating frequency of all movies**"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "YqfWKYCEz782",
        "outputId": "93b3ac8c-a39f-44e5-9c2f-39ce2d9b6b55",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 195
        }
      },
      "source": [
        "refined_dataset.head()"
      ],
      "execution_count": 134,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>user id</th>\n",
              "      <th>movie title</th>\n",
              "      <th>rating</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1</td>\n",
              "      <td>101 Dalmatians (1996)</td>\n",
              "      <td>2.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>1</td>\n",
              "      <td>12 Angry Men (1957)</td>\n",
              "      <td>5.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>1</td>\n",
              "      <td>20,000 Leagues Under the Sea (1954)</td>\n",
              "      <td>3.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>1</td>\n",
              "      <td>2001: A Space Odyssey (1968)</td>\n",
              "      <td>4.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>1</td>\n",
              "      <td>Abyss, The (1989)</td>\n",
              "      <td>3.0</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "   user id                          movie title  rating\n",
              "0        1                101 Dalmatians (1996)     2.0\n",
              "1        1                  12 Angry Men (1957)     5.0\n",
              "2        1  20,000 Leagues Under the Sea (1954)     3.0\n",
              "3        1         2001: A Space Odyssey (1968)     4.0\n",
              "4        1                    Abyss, The (1989)     3.0"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 134
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "oTe-A4D156Ry",
        "outputId": "f64f656a-b218-4ab1-95a3-e01641fbe434",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 225
        }
      },
      "source": [
        "# get rating frequency\n",
        "movies_count_df = pd.DataFrame(refined_dataset.groupby('movie title').size(), columns=['count'])\n",
        "movies_count_df.head()"
      ],
      "execution_count": 135,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>count</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>movie title</th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>'Til There Was You (1997)</th>\n",
              "      <td>9</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1-900 (1994)</th>\n",
              "      <td>5</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>101 Dalmatians (1996)</th>\n",
              "      <td>109</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>12 Angry Men (1957)</th>\n",
              "      <td>125</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>187 (1997)</th>\n",
              "      <td>41</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "                           count\n",
              "movie title                     \n",
              "'Til There Was You (1997)      9\n",
              "1-900 (1994)                   5\n",
              "101 Dalmatians (1996)        109\n",
              "12 Angry Men (1957)          125\n",
              "187 (1997)                    41"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 135
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "2PZxHmrq6MTz",
        "outputId": "e2b555d2-c2f9-44db-de48-8e57efe3e4c5",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 533
        }
      },
      "source": [
        "# plot rating frequency of all movies\n",
        "ax = movies_count_df \\\n",
        "    .sort_values('count', ascending=False) \\\n",
        "    .reset_index(drop=True) \\\n",
        "    .plot(\n",
        "        figsize=(12, 8),\n",
        "        title='Rating Frequency of All Movies',\n",
        "        fontsize=12\n",
        "    )\n",
        "ax.set_xlabel(\"movie Id\")\n",
        "ax.set_ylabel(\"number of ratings\")"
      ],
      "execution_count": 136,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "Text(0, 0.5, 'number of ratings')"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 136
        },
        {
          "output_type": "display_data",
          "data": {
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAtcAAAHzCAYAAADrWzHgAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdeZhcZZn38e/de5LO3p2NkAUSSAgQlgiyb4q4MKAwiiCCCIwr7jPzjhsDOOq4jAOKCyMKAi4ooCgiO4gsGiAhhIQ9CSELnX1POt3P+0dVYxlC0qSr+nSqvp/rqitV5znn1F0VLvjVw32eEyklJEmSJHVdVdYFSJIkSeXCcC1JkiQVieFakiRJKhLDtSRJklQkhmtJkiSpSAzXkiRJUpEYriWVvYj4QUR8Mes6KlVEvDMiXoyINRGx/w4cf09EnJt/fnZE3F/8Kjtdy39ExP9l9f6Sej7DtaQeJyLmRMT6fBhbFBE/jYjGTh77qvCVUvpQSuniEtQ5JiJSvs6Ox/Riv08Z+CbwsZRSY0rpsa3tEDnPR8STO/omBX8fj22xvSkiNkXEnB09d4eU0n+llM7t6nkklS/DtaSe6sSUUiOwH7A/8P8yrmdbBuSDY2NKafKWgxFRk0VRPchoYOZ29jkSGALsFhFv6OL79Y6IvQtenw680MVzSlKnGK4l9WgppUXAn8iFbAAi4t8j4rmIW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hmci1JY89S4IyIeAb4KvCBvG23Ae+jy5SQPFcCV0fE0+SmnVzez3t9EvjriHgWmD2URkvSWBC5gQxJkiRJQ+XItSRJklQgJteSJElSgZhcS5IkSQVici1JkiQViMm1JEmSVCAm15IkSVKBmFxLkiRJBWJyLUmSJBXI/wPJ4L6LWl73RwAAAABJRU5ErkJggg==\n",
            "text/plain": [
              "<Figure size 864x576 with 1 Axes>"
            ]
          },
          "metadata": {
            "tags": [],
            "needs_background": "light"
          }
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "PyCcV_0j6yUw"
      },
      "source": [
        "**As the size of MovieLens dataset picked for this project is small. There is no need of removing rarely rated movies or users who has given rating for fewer movies.**\n",
        "\n",
        "**Also because the dataset considered is small, we do not see the long-tail property which will be the scenario with the distribution of ratings.**\n",
        "\n",
        "*If the dataset is larger, then* (this can be referred when we do similar kind of tasks with a larger dataset, just for future reference)\n",
        "\n",
        "The distribution of ratings among movies often satisfies a property in real-world settings, which is referred to as the long-tail property. According to this property, only a small fraction of the items are rated frequently. Such items are referred to as popular items. The vast majority of items are rated rarely. This results in a highly skewed distribution of the underlying ratings."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "PZD27ZLM8IN7"
      },
      "source": [
        "# Training KNN model to build item-based collaborative Recommender System."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "5omV7GyNTITK"
      },
      "source": [
        "**Reshaping the dataframe**\n",
        "\n",
        "We need to transform (reshape in this case) the data in such a way that each row of the dataframe represents a movie and each column represents a different user. So we want the data to be [movies, users] array if movie is the subject where similar movies must be found and [users, movies] array for reverse.\n",
        "\n",
        "To reshape the dataframe, we will pivot the dataframe to the wide format with movies as rows and users as columns. As we know that not all users watch all the movies, we can expect a lot of missing values. We will have to fill those missing observations with 0s since we are going to perform linear algebra operations (calculating distances between vectors). \n",
        "\n",
        "Finally, we transform the values of the dataframe into a scipy sparse matrix for most efficient calculations.\n",
        "\n",
        "This dataframe is then fed into a KNN model."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "IyvX84Lm6ToE"
      },
      "source": [
        "## Movie Recommendation using KNN with Input as **User id**, Number of similar users should the model pick and Number of movies you want to get recommended:"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "3qJCE3l3f2mY"
      },
      "source": [
        "1. Reshaping model in such a way that each user has n-dimensional rating space where n is total number of movies\n",
        "\n",
        " We will train the KNN model inorder to find the closely matching similar users to the user we give as input and we recommend the top movies which would interest the input user."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "pVjDfpRvWVhw",
        "outputId": "d4e854fb-2020-4c7e-88c4-57b2e5d638cb",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 391
        }
      },
      "source": [
        "# pivot and create movie-user matrix\n",
        "user_to_movie_df = refined_dataset.pivot(\n",
        "    index='user id',\n",
        "     columns='movie title',\n",
        "      values='rating').fillna(0)\n",
        "\n",
        "user_to_movie_df.head()"
      ],
      "execution_count": 138,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th>movie title</th>\n",
              "      <th>'Til There Was You (1997)</th>\n",
              "      <th>1-900 (1994)</th>\n",
              "      <th>101 Dalmatians (1996)</th>\n",
              "      <th>12 Angry Men (1957)</th>\n",
              "      <th>187 (1997)</th>\n",
              "      <th>2 Days in the Valley (1996)</th>\n",
              "      <th>20,000 Leagues Under the Sea (1954)</th>\n",
              "      <th>2001: A Space Odyssey (1968)</th>\n",
              "      <th>3 Ninjas: High Noon At Mega Mountain (1998)</th>\n",
              "      <th>39 Steps, The (1935)</th>\n",
              "      <th>8 1/2 (1963)</th>\n",
              "      <th>8 Heads in a Duffel Bag (1997)</th>\n",
              "      <th>8 Seconds (1994)</th>\n",
              "      <th>A Chef in Love (1996)</th>\n",
              "      <th>Above the Rim (1994)</th>\n",
              "      <th>Absolute Power (1997)</th>\n",
              "      <th>Abyss, The (1989)</th>\n",
              "      <th>Ace Ventura: Pet Detective (1994)</th>\n",
              "      <th>Ace Ventura: When Nature Calls (1995)</th>\n",
              "      <th>Across the Sea of Time (1995)</th>\n",
              "      <th>Addams Family Values (1993)</th>\n",
              "      <th>Addicted to Love (1997)</th>\n",
              "      <th>Addiction, The (1995)</th>\n",
              "      <th>Adventures of Pinocchio, The (1996)</th>\n",
              "      <th>Adventures of Priscilla, Queen of the Desert, The (1994)</th>\n",
              "      <th>Adventures of Robin Hood, The (1938)</th>\n",
              "      <th>Affair to Remember, An (1957)</th>\n",
              "      <th>African Queen, The (1951)</th>\n",
              "      <th>Afterglow (1997)</th>\n",
              "      <th>Age of Innocence, The (1993)</th>\n",
              "      <th>Aiqing wansui (1994)</th>\n",
              "      <th>Air Bud (1997)</th>\n",
              "      <th>Air Force One (1997)</th>\n",
              "      <th>Air Up There, The (1994)</th>\n",
              "      <th>Airheads (1994)</th>\n",
              "      <th>Akira (1988)</th>\n",
              "      <th>Aladdin (1992)</th>\n",
              "      <th>Aladdin and the King of Thieves (1996)</th>\n",
              "      <th>Alaska (1996)</th>\n",
              "      <th>Albino Alligator (1996)</th>\n",
              "      <th>...</th>\n",
              "      <th>Whole Wide World, The (1996)</th>\n",
              "      <th>Widows' Peak (1994)</th>\n",
              "      <th>Wife, The (1995)</th>\n",
              "      <th>Wild America (1997)</th>\n",
              "      <th>Wild Bill (1995)</th>\n",
              "      <th>Wild Bunch, The (1969)</th>\n",
              "      <th>Wild Reeds (1994)</th>\n",
              "      <th>Wild Things (1998)</th>\n",
              "      <th>William Shakespeare's Romeo and Juliet (1996)</th>\n",
              "      <th>Willy Wonka and the Chocolate Factory (1971)</th>\n",
              "      <th>Window to Paris (1994)</th>\n",
              "      <th>Wings of Courage (1995)</th>\n",
              "      <th>Wings of Desire (1987)</th>\n",
              "      <th>Wings of the Dove, The (1997)</th>\n",
              "      <th>Winnie the Pooh and the Blustery Day (1968)</th>\n",
              "      <th>Winter Guest, The (1997)</th>\n",
              "      <th>Wishmaster (1997)</th>\n",
              "      <th>With Honors (1994)</th>\n",
              "      <th>Withnail and I (1987)</th>\n",
              "      <th>Witness (1985)</th>\n",
              "      <th>Wizard of Oz, The (1939)</th>\n",
              "      <th>Wolf (1994)</th>\n",
              "      <th>Woman in Question, The (1950)</th>\n",
              "      <th>Women, The (1939)</th>\n",
              "      <th>Wonderful, Horrible Life of Leni Riefenstahl, The (1993)</th>\n",
              "      <th>Wonderland (1997)</th>\n",
              "      <th>Wooden Man's Bride, The (Wu Kui) (1994)</th>\n",
              "      <th>World of Apu, The (Apur Sansar) (1959)</th>\n",
              "      <th>Wrong Trousers, The (1993)</th>\n",
              "      <th>Wyatt Earp (1994)</th>\n",
              "      <th>Yankee Zulu (1994)</th>\n",
              "      <th>Year of the Horse (1997)</th>\n",
              "      <th>You So Crazy (1994)</th>\n",
              "      <th>Young Frankenstein (1974)</th>\n",
              "      <th>Young Guns (1988)</th>\n",
              "      <th>Young Guns II (1990)</th>\n",
              "      <th>Young Poisoner's Handbook, The (1995)</th>\n",
              "      <th>Zeus and Roxanne (1997)</th>\n",
              "      <th>unknown</th>\n",
              "      <th>Á köldum klaka (Cold Fever) (1994)</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>user id</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>2.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>3.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>3.0</td>\n",
              "      <td>3.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>1.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>...</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>3.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>1.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>3.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>...</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>2.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>2.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>...</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>...</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>2.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>1.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>2.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>3.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>...</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>1.0</td>\n",
              "      <td>3.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>5 rows × 1664 columns</p>\n",
              "</div>"
            ],
            "text/plain": [
              "movie title  'Til There Was You (1997)  ...  Á köldum klaka (Cold Fever) (1994)\n",
              "user id                                 ...                                    \n",
              "1                                  0.0  ...                                 0.0\n",
              "2                                  0.0  ...                                 0.0\n",
              "3                                  0.0  ...                                 0.0\n",
              "4                                  0.0  ...                                 0.0\n",
              "5                                  0.0  ...                                 0.0\n",
              "\n",
              "[5 rows x 1664 columns]"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 138
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "NzGiLk_P6ZPU",
        "outputId": "ce7e1849-a29d-456b-9eb7-a17190231787",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 50
        }
      },
      "source": [
        "# transform matrix to scipy sparse matrix\n",
        "user_to_movie_sparse_df = csr_matrix(user_to_movie_df.values)\n",
        "user_to_movie_sparse_df"
      ],
      "execution_count": 139,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "<943x1664 sparse matrix of type '<class 'numpy.float64'>'\n",
              "\twith 99693 stored elements in Compressed Sparse Row format>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 139
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "_lmFFozScX9B"
      },
      "source": [
        "**Fitting K-Nearest Neighbours model to the scipy sparse matrix:**"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "T-C_KVvkglZZ",
        "outputId": "fa672186-a2c4-478a-9e26-5a8d9eaa8334",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 67
        }
      },
      "source": [
        "knn_model = NearestNeighbors(metric='cosine', algorithm='brute')\n",
        "knn_model.fit(user_to_movie_sparse_df)"
      ],
      "execution_count": 140,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "NearestNeighbors(algorithm='brute', leaf_size=30, metric='cosine',\n",
              "                 metric_params=None, n_jobs=None, n_neighbors=5, p=2,\n",
              "                 radius=1.0)"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 140
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "GznTZhlIcPCI"
      },
      "source": [
        "## function to find top n similar users of the given input user \n",
        "def get_similar_users(user, n = 5):\n",
        "  ## input to this function is the user and number of top similar users you want.\n",
        "\n",
        "  knn_input = np.asarray([user_to_movie_df.values[user-1]])  #.reshape(1,-1)\n",
        "  # knn_input = user_to_movie_df.iloc[0,:].values.reshape(1,-1)\n",
        "  distances, indices = knn_model.kneighbors(knn_input, n_neighbors=n+1)\n",
        "  \n",
        "  print(\"Top\",n,\"users who are very much similar to the User-\",user, \"are: \")\n",
        "  print(\" \")\n",
        "  for i in range(1,len(distances[0])):\n",
        "    print(i,\". User:\", indices[0][i]+1, \"separated by distance of\",distances[0][i])\n",
        "  return indices.flatten()[1:] + 1, distances.flatten()[1:]\n"
      ],
      "execution_count": 141,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "UzD2cOe361JX"
      },
      "source": [
        "**Specify User id and Number of similar users we want to consider here**"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ZAc5xnl2mZp3",
        "outputId": "9f9a1dd7-2877-4cdc-fd5f-e6282ac42a3e",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 319
        }
      },
      "source": [
        "from pprint import pprint\n",
        "user_id = 778\n",
        "print(\" Few of movies seen by the User:\")\n",
        "pprint(list(refined_dataset[refined_dataset['user id'] == user_id]['movie title'])[:10])\n",
        "similar_user_list, distance_list = get_similar_users(user_id,5)"
      ],
      "execution_count": 142,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            " Few of movies seen by the User:\n",
            "['Amityville Horror, The (1979)',\n",
            " 'Angels in the Outfield (1994)',\n",
            " 'Apocalypse Now (1979)',\n",
            " 'Apollo 13 (1995)',\n",
            " 'Austin Powers: International Man of Mystery (1997)',\n",
            " 'Babe (1995)',\n",
            " 'Back to the Future (1985)',\n",
            " 'Blues Brothers, The (1980)',\n",
            " 'Chasing Amy (1997)',\n",
            " 'Clerks (1994)']\n",
            "Top 5 users who are very much similar to the User- 778 are: \n",
            " \n",
            "1 . User: 124 separated by distance of 0.4586649429539592\n",
            "2 . User: 933 separated by distance of 0.5581959868865324\n",
            "3 . User: 56 separated by distance of 0.5858413112292744\n",
            "4 . User: 738 separated by distance of 0.5916272517988691\n",
            "5 . User: 653 separated by distance of 0.5991479757406326\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "LDtU_DkCqLl6"
      },
      "source": [
        "**With the help of the KNN model built, we could get desired number of top similar users.**\n",
        "\n",
        "**Now we will have to pick the top movies to recommend.**\n",
        "\n",
        "**One way would be by taking the average of the existing ratings given by the similar users and picking the top 10 or 15 movies to recommend to our current user.**\n",
        "\n",
        "**But I feel recommendation would be more effective if we define weights to ratings by each similar user based on the thier distance from the input user. Defining these weights would give us the accurate recommendations by eliminating the chance of decision manipulation by the users who are relatively very far from the input user.**"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "3JNvsjkzhXj4",
        "outputId": "d8f1e6b9-9d26-4415-8ad9-f5b4b5049aec",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 50
        }
      },
      "source": [
        "similar_user_list, distance_list"
      ],
      "execution_count": 143,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "(array([124, 933,  56, 738, 653]),\n",
              " array([0.45866494, 0.55819599, 0.58584131, 0.59162725, 0.59914798]))"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 143
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "7de9PUuitY5p",
        "outputId": "360455f1-412d-4b07-ed51-c704da2d788c",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "weightage_list = distance_list/np.sum(distance_list)\n",
        "weightage_list"
      ],
      "execution_count": 144,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "array([0.16419139, 0.19982119, 0.20971757, 0.2117888 , 0.21448105])"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 144
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "lCX18TkDtnz8"
      },
      "source": [
        "Getting ratings of all movies by derived similar users"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "VEh6O0oAtv_F",
        "outputId": "140cf5f4-a9fb-47a7-8365-6fab2d732462",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 101
        }
      },
      "source": [
        "mov_rtngs_sim_users = user_to_movie_df.values[similar_user_list]\n",
        "mov_rtngs_sim_users"
      ],
      "execution_count": 145,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "array([[0., 0., 0., ..., 0., 0., 0.],\n",
              "       [0., 0., 2., ..., 0., 0., 0.],\n",
              "       [0., 0., 3., ..., 0., 0., 0.],\n",
              "       [0., 0., 0., ..., 0., 0., 0.],\n",
              "       [0., 0., 0., ..., 0., 0., 0.]])"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 145
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "nhty6LqMur17",
        "outputId": "d49cf83a-3e2c-4092-c477-77f81b285735",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 202
        }
      },
      "source": [
        "movies_list = user_to_movie_df.columns\n",
        "movies_list"
      ],
      "execution_count": 146,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "Index([''Til There Was You (1997)', '1-900 (1994)', '101 Dalmatians (1996)',\n",
              "       '12 Angry Men (1957)', '187 (1997)', '2 Days in the Valley (1996)',\n",
              "       '20,000 Leagues Under the Sea (1954)', '2001: A Space Odyssey (1968)',\n",
              "       '3 Ninjas: High Noon At Mega Mountain (1998)', '39 Steps, The (1935)',\n",
              "       ...\n",
              "       'Yankee Zulu (1994)', 'Year of the Horse (1997)', 'You So Crazy (1994)',\n",
              "       'Young Frankenstein (1974)', 'Young Guns (1988)',\n",
              "       'Young Guns II (1990)', 'Young Poisoner's Handbook, The (1995)',\n",
              "       'Zeus and Roxanne (1997)', 'unknown',\n",
              "       'Á köldum klaka (Cold Fever) (1994)'],\n",
              "      dtype='object', name='movie title', length=1664)"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 146
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "c_nwkKwhvQ7Y",
        "outputId": "bed4129d-df39-4742-8906-b24469f36cbf",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 67
        }
      },
      "source": [
        "print(\"Weightage list shape:\", len(weightage_list))\n",
        "print(\"mov_rtngs_sim_users shape:\", mov_rtngs_sim_users.shape)\n",
        "print(\"Number of movies:\", len(movies_list))"
      ],
      "execution_count": 147,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Weightage list shape: 5\n",
            "mov_rtngs_sim_users shape: (5, 1664)\n",
            "Number of movies: 1664\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "oMgSULlTx71x"
      },
      "source": [
        "**Broadcasting weightage matrix to similar user rating matrix. so that it gets compatible for matrix operations**"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "0WF66O37x7WH",
        "outputId": "8f6b8c87-d797-4485-8468-48b6802439d1",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "weightage_list = weightage_list[:,np.newaxis] + np.zeros(len(movies_list))\n",
        "weightage_list.shape"
      ],
      "execution_count": 148,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "(5, 1664)"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 148
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "RI6iizTIx7SO",
        "outputId": "e31a105c-d826-4928-ec93-15cf58e2cd42",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 50
        }
      },
      "source": [
        "new_rating_matrix = weightage_list*mov_rtngs_sim_users\n",
        "mean_rating_list = new_rating_matrix.sum(axis =0)\n",
        "mean_rating_list"
      ],
      "execution_count": 149,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "array([0.        , 0.        , 1.02879509, ..., 0.        , 0.        ,\n",
              "       0.        ])"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 149
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "jasA8xEWu3Sj"
      },
      "source": [
        "from pprint import pprint\n",
        "def recommend_movies(n):\n",
        "  n = min(len(mean_rating_list),n)\n",
        "  # print(np.argsort(mean_rating_list)[::-1][:n])\n",
        "  pprint(list(movies_list[np.argsort(mean_rating_list)[::-1][:n]]))\n",
        "\n"
      ],
      "execution_count": 150,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "4ix_nK1I33WS",
        "outputId": "64cfee5b-3f39-4616-81f3-d7a044706504",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 202
        }
      },
      "source": [
        "print(\"Movies recommended based on similar users are: \")\n",
        "recommend_movies(10)"
      ],
      "execution_count": 151,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Movies recommended based on similar users are: \n",
            "['Star Wars (1977)',\n",
            " 'Terminator, The (1984)',\n",
            " \"Schindler's List (1993)\",\n",
            " 'Fugitive, The (1993)',\n",
            " 'Forrest Gump (1994)',\n",
            " 'Princess Bride, The (1987)',\n",
            " 'Empire Strikes Back, The (1980)',\n",
            " 'Pulp Fiction (1994)',\n",
            " 'Die Hard (1988)',\n",
            " 'Monty Python and the Holy Grail (1974)']\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "MZh3ID7NgwD7"
      },
      "source": [
        "It had been observed that, this recommendation system built can be made more efficient as it has few drawbacks.\n",
        "\n",
        "**Drawbacks:**\n",
        "\n",
        "**1.** But this recommendation system has a drawback, it also **recommends movies which are already seen by the given input User.**\n",
        "\n",
        "**2.** And also there is a possibility of recommending the **movies which are not at all seen by any of the similar users.**"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "cMOC4pKzkKiQ"
      },
      "source": [
        "**Above drawbacks are addressed and a new recommender system with modification is built**\n",
        "\n",
        "Below function is defined to remove the movies which are already seen the current user and not at all seen by any of the similar users."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "cC5fgG3-iXei"
      },
      "source": [
        "\n",
        "def filtered_movie_recommendations(n):\n",
        "  \n",
        "  first_zero_index = np.where(mean_rating_list == 0)[0][-1]\n",
        "  sortd_index = np.argsort(mean_rating_list)[::-1]\n",
        "  sortd_index = sortd_index[:list(sortd_index).index(first_zero_index)]\n",
        "  n = min(len(sortd_index),n)\n",
        "  movies_watched = list(refined_dataset[refined_dataset['user id'] == user_id]['movie title'])\n",
        "  filtered_movie_list = list(movies_list[sortd_index])\n",
        "  count = 0\n",
        "  final_movie_list = []\n",
        "  for i in filtered_movie_list:\n",
        "    if i not in movies_watched:\n",
        "      count+=1\n",
        "      final_movie_list.append(i)\n",
        "    if count == n:\n",
        "      break\n",
        "  if count == 0:\n",
        "    print(\"There are no movies left which are not seen by the input users and seen by similar users. May be increasing the number of similar users who are to be considered may give a chance of suggesting an unseen good movie.\")\n",
        "  else:\n",
        "    pprint(final_movie_list)\n"
      ],
      "execution_count": 152,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "hhk_3V2QyeNz",
        "outputId": "d47981dd-3691-4255-a783-7b8fb2ce5d03",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 185
        }
      },
      "source": [
        "filtered_movie_recommendations(10)"
      ],
      "execution_count": 153,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "['Star Wars (1977)',\n",
            " \"Schindler's List (1993)\",\n",
            " 'Princess Bride, The (1987)',\n",
            " 'Empire Strikes Back, The (1980)',\n",
            " 'Return of the Jedi (1983)',\n",
            " 'Fargo (1996)',\n",
            " 'Dances with Wolves (1990)',\n",
            " 'Toy Story (1995)',\n",
            " 'Braveheart (1995)',\n",
            " 'Star Trek: First Contact (1996)']\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "MI7T25n6ZOEf"
      },
      "source": [
        "Coding up all of the above individual cells into a function.\n",
        "\n",
        "Giving Input as **User id, Number of similar Users to be considered, Number of top movie we want to recommend**"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "GQ4UfrTM33hF"
      },
      "source": [
        "from pprint import pprint\n",
        "\n",
        "def recommender_system(user_id, n_similar_users, n_movies): #, user_to_movie_df, knn_model):\n",
        "  \n",
        "  print(\"Movie seen by the User:\")\n",
        "  pprint(list(refined_dataset[refined_dataset['user id'] == user_id]['movie title']))\n",
        "  print(\"\")\n",
        "\n",
        "  # def get_similar_users(user, user_to_movie_df, knn_model, n = 5):\n",
        "  def get_similar_users(user, n = 5):\n",
        "    \n",
        "    knn_input = np.asarray([user_to_movie_df.values[user-1]])\n",
        "    \n",
        "    distances, indices = knn_model.kneighbors(knn_input, n_neighbors=n+1)\n",
        "    \n",
        "    print(\"Top\",n,\"users who are very much similar to the User-\",user, \"are: \")\n",
        "    print(\" \")\n",
        "\n",
        "    for i in range(1,len(distances[0])):\n",
        "      print(i,\". User:\", indices[0][i]+1, \"separated by distance of\",distances[0][i])\n",
        "    print(\"\")\n",
        "    return indices.flatten()[1:] + 1, distances.flatten()[1:]\n",
        "\n",
        "\n",
        "  def filtered_movie_recommendations(n = 10):\n",
        "  \n",
        "    first_zero_index = np.where(mean_rating_list == 0)[0][-1]\n",
        "    sortd_index = np.argsort(mean_rating_list)[::-1]\n",
        "    sortd_index = sortd_index[:list(sortd_index).index(first_zero_index)]\n",
        "    n = min(len(sortd_index),n)\n",
        "    movies_watched = list(refined_dataset[refined_dataset['user id'] == user_id]['movie title'])\n",
        "    filtered_movie_list = list(movies_list[sortd_index])\n",
        "    count = 0\n",
        "    final_movie_list = []\n",
        "    for i in filtered_movie_list:\n",
        "      if i not in movies_watched:\n",
        "        count+=1\n",
        "        final_movie_list.append(i)\n",
        "      if count == n:\n",
        "        break\n",
        "    if count == 0:\n",
        "      print(\"There are no movies left which are not seen by the input users and seen by similar users. May be increasing the number of similar users who are to be considered may give a chance of suggesting an unseen good movie.\")\n",
        "    else:\n",
        "      pprint(final_movie_list)\n",
        "\n",
        "  similar_user_list, distance_list = get_similar_users(user_id,n_similar_users)\n",
        "  weightage_list = distance_list/np.sum(distance_list)\n",
        "  mov_rtngs_sim_users = user_to_movie_df.values[similar_user_list]\n",
        "  movies_list = user_to_movie_df.columns\n",
        "  weightage_list = weightage_list[:,np.newaxis] + np.zeros(len(movies_list))\n",
        "  new_rating_matrix = weightage_list*mov_rtngs_sim_users\n",
        "  mean_rating_list = new_rating_matrix.sum(axis =0)\n",
        "  print(\"\")\n",
        "  print(\"Movies recommended based on similar users are: \")\n",
        "  print(\"\")\n",
        "  filtered_movie_recommendations(n_movies)"
      ],
      "execution_count": 233,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ZhQI_qBL33dj",
        "outputId": "fae03002-e4c8-46d9-b4ef-e5f0bcdb1781",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "print(\"Enter user id\")\n",
        "user_id= int(input())\n",
        "print(\"number of similar users to be considered\")\n",
        "sim_users = int(input())\n",
        "print(\"Enter number of movies to be recommended:\")\n",
        "n_movies = int(input())\n",
        "recommender_system(user_id,sim_users,n_movies)\n",
        "# recommender_system(300, 15,15)"
      ],
      "execution_count": 234,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Enter user id\n",
            "307\n",
            "number of similar users to be considered\n",
            "15\n",
            "Enter number of movies to be recommended:\n",
            "15\n",
            "Movie seen by the User:\n",
            "['12 Angry Men (1957)',\n",
            " '2001: A Space Odyssey (1968)',\n",
            " 'Abyss, The (1989)',\n",
            " 'Alien (1979)',\n",
            " 'Apollo 13 (1995)',\n",
            " 'Back to the Future (1985)',\n",
            " 'Barbarella (1968)',\n",
            " 'Batman (1989)',\n",
            " 'Beauty and the Beast (1991)',\n",
            " 'Blade Runner (1982)',\n",
            " 'Blues Brothers, The (1980)',\n",
            " 'Boot, Das (1981)',\n",
            " 'Brady Bunch Movie, The (1995)',\n",
            " 'Braveheart (1995)',\n",
            " 'Brazil (1985)',\n",
            " 'Casablanca (1942)',\n",
            " 'Close Shave, A (1995)',\n",
            " 'Contact (1997)',\n",
            " 'Crying Game, The (1992)',\n",
            " 'Dead Poets Society (1989)',\n",
            " 'Dial M for Murder (1954)',\n",
            " 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb (1963)',\n",
            " 'Dragonheart (1996)',\n",
            " 'E.T. the Extra-Terrestrial (1982)',\n",
            " 'Empire Strikes Back, The (1980)',\n",
            " 'English Patient, The (1996)',\n",
            " 'Englishman Who Went Up a Hill, But Came Down a Mountain, The (1995)',\n",
            " 'Escape from L.A. (1996)',\n",
            " 'Fargo (1996)',\n",
            " 'Fast, Cheap & Out of Control (1997)',\n",
            " 'Field of Dreams (1989)',\n",
            " 'Fish Called Wanda, A (1988)',\n",
            " 'Four Weddings and a Funeral (1994)',\n",
            " 'Fried Green Tomatoes (1991)',\n",
            " 'Full Monty, The (1997)',\n",
            " 'Gandhi (1982)',\n",
            " 'Ghost (1990)',\n",
            " 'Graduate, The (1967)',\n",
            " 'Grand Day Out, A (1992)',\n",
            " 'Grumpier Old Men (1995)',\n",
            " 'Harold and Maude (1971)',\n",
            " 'Heathers (1989)',\n",
            " 'Heavy Metal (1981)',\n",
            " 'Highlander (1986)',\n",
            " 'Home Alone (1990)',\n",
            " 'How to Make an American Quilt (1995)',\n",
            " 'Hudsucker Proxy, The (1994)',\n",
            " 'Hunt for Red October, The (1990)',\n",
            " 'Independence Day (ID4) (1996)',\n",
            " 'Indiana Jones and the Last Crusade (1989)',\n",
            " 'Jurassic Park (1993)',\n",
            " 'Koyaanisqatsi (1983)',\n",
            " 'Lawnmower Man, The (1992)',\n",
            " 'Lawrence of Arabia (1962)',\n",
            " 'Like Water For Chocolate (Como agua para chocolate) (1992)',\n",
            " 'Lion King, The (1994)',\n",
            " 'Mary Poppins (1964)',\n",
            " 'Mask, The (1994)',\n",
            " \"McHale's Navy (1997)\",\n",
            " 'Men in Black (1997)',\n",
            " \"Microcosmos: Le peuple de l'herbe (1996)\",\n",
            " 'Monty Python and the Holy Grail (1974)',\n",
            " \"Monty Python's Life of Brian (1979)\",\n",
            " 'Mrs. Doubtfire (1993)',\n",
            " 'Much Ado About Nothing (1993)',\n",
            " 'Muppet Treasure Island (1996)',\n",
            " 'My Left Foot (1989)',\n",
            " 'My Life as a Dog (Mitt liv som hund) (1985)',\n",
            " 'Mystery Science Theater 3000: The Movie (1996)',\n",
            " 'Nightmare Before Christmas, The (1993)',\n",
            " 'Pink Floyd - The Wall (1982)',\n",
            " 'Pretty Woman (1990)',\n",
            " 'Princess Bride, The (1987)',\n",
            " 'Psycho (1960)',\n",
            " 'Pulp Fiction (1994)',\n",
            " 'Raiders of the Lost Ark (1981)',\n",
            " 'Real Genius (1985)',\n",
            " 'Return of the Jedi (1983)',\n",
            " 'Return of the Pink Panther, The (1974)',\n",
            " 'Right Stuff, The (1983)',\n",
            " 'Road to Wellville, The (1994)',\n",
            " 'Robin Hood: Men in Tights (1993)',\n",
            " 'Rumble in the Bronx (1995)',\n",
            " 'Secret of Roan Inish, The (1994)',\n",
            " 'Sex, Lies, and Videotape (1989)',\n",
            " 'Shadowlands (1993)',\n",
            " 'Shawshank Redemption, The (1994)',\n",
            " 'Shining, The (1980)',\n",
            " 'Sneakers (1992)',\n",
            " 'Snow White and the Seven Dwarfs (1937)',\n",
            " 'Sound of Music, The (1965)',\n",
            " 'Stand by Me (1986)',\n",
            " 'Star Trek III: The Search for Spock (1984)',\n",
            " 'Star Trek IV: The Voyage Home (1986)',\n",
            " 'Star Trek V: The Final Frontier (1989)',\n",
            " 'Star Trek VI: The Undiscovered Country (1991)',\n",
            " 'Star Trek: First Contact (1996)',\n",
            " 'Star Trek: Generations (1994)',\n",
            " 'Star Trek: The Motion Picture (1979)',\n",
            " 'Star Trek: The Wrath of Khan (1982)',\n",
            " 'Star Wars (1977)',\n",
            " 'Stargate (1994)',\n",
            " 'Tank Girl (1995)',\n",
            " 'Terminator, The (1984)',\n",
            " 'This Is Spinal Tap (1984)',\n",
            " 'Titanic (1997)',\n",
            " 'To Kill a Mockingbird (1962)',\n",
            " 'Top Gun (1986)',\n",
            " 'Toy Story (1995)',\n",
            " 'Wallace & Gromit: The Best of Aardman Animation (1996)',\n",
            " 'Wizard of Oz, The (1939)',\n",
            " 'Wrong Trousers, The (1993)']\n",
            "\n",
            "Top 15 users who are very much similar to the User- 307 are: \n",
            " \n",
            "1 . User: 70 separated by distance of 0.4560883724650484\n",
            "2 . User: 738 separated by distance of 0.4846662001127756\n",
            "3 . User: 922 separated by distance of 0.503221313979523\n",
            "4 . User: 407 separated by distance of 0.5038250337403114\n",
            "5 . User: 514 separated by distance of 0.5060750098353226\n",
            "6 . User: 44 separated by distance of 0.5160506271876224\n",
            "7 . User: 660 separated by distance of 0.5165826487301209\n",
            "8 . User: 5 separated by distance of 0.5211146313938015\n",
            "9 . User: 457 separated by distance of 0.5309167131718452\n",
            "10 . User: 23 separated by distance of 0.5316197783536492\n",
            "11 . User: 843 separated by distance of 0.5324703658288387\n",
            "12 . User: 64 separated by distance of 0.53318921205275\n",
            "13 . User: 198 separated by distance of 0.535682894616484\n",
            "14 . User: 815 separated by distance of 0.5416036160331636\n",
            "15 . User: 95 separated by distance of 0.5468066886836396\n",
            "\n",
            "\n",
            "Movies recommended based on similar users are: \n",
            "\n",
            "[\"Schindler's List (1993)\",\n",
            " 'Liar Liar (1997)',\n",
            " 'When Harry Met Sally... (1989)',\n",
            " 'Leaving Las Vegas (1995)',\n",
            " 'Silence of the Lambs, The (1991)',\n",
            " 'Dead Man Walking (1995)',\n",
            " 'Trainspotting (1996)',\n",
            " 'Forrest Gump (1994)',\n",
            " 'Scream (1996)',\n",
            " 'Twelve Monkeys (1995)',\n",
            " 'Jerry Maguire (1996)',\n",
            " 'Raising Arizona (1987)',\n",
            " 'Godfather, The (1972)',\n",
            " 'Rock, The (1996)',\n",
            " 'Fugitive, The (1993)']\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "9i5m2wO4iQUW"
      },
      "source": [
        "## Movie Recommendation using KNN with Input as **Movie Name** and Number of movies you want to get recommended:"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "XaQLSI1ni_qS"
      },
      "source": [
        "2. Reshaping model in such a way that each movie has n-dimensional rating space where n is total number of users who could rate.\n",
        "\n",
        " We will train the KNN model inorder to find the closely matching similar movies to the movie we give as input and we recommend the top movies which would more closely align to the movie we have given."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "pKgkHLCN33ZT",
        "outputId": "9b3ac3a7-2436-47ef-f6a6-fb39fc62c515",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 391
        }
      },
      "source": [
        "# pivot and create movie-user matrix\n",
        "movie_to_user_df = refined_dataset.pivot(\n",
        "     index='movie title',\n",
        "   columns='user id',\n",
        "      values='rating').fillna(0)\n",
        "\n",
        "movie_to_user_df.head()"
      ],
      "execution_count": 157,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th>user id</th>\n",
              "      <th>1</th>\n",
              "      <th>2</th>\n",
              "      <th>3</th>\n",
              "      <th>4</th>\n",
              "      <th>5</th>\n",
              "      <th>6</th>\n",
              "      <th>7</th>\n",
              "      <th>8</th>\n",
              "      <th>9</th>\n",
              "      <th>10</th>\n",
              "      <th>11</th>\n",
              "      <th>12</th>\n",
              "      <th>13</th>\n",
              "      <th>14</th>\n",
              "      <th>15</th>\n",
              "      <th>16</th>\n",
              "      <th>17</th>\n",
              "      <th>18</th>\n",
              "      <th>19</th>\n",
              "      <th>20</th>\n",
              "      <th>21</th>\n",
              "      <th>22</th>\n",
              "      <th>23</th>\n",
              "      <th>24</th>\n",
              "      <th>25</th>\n",
              "      <th>26</th>\n",
              "      <th>27</th>\n",
              "      <th>28</th>\n",
              "      <th>29</th>\n",
              "      <th>30</th>\n",
              "      <th>31</th>\n",
              "      <th>32</th>\n",
              "      <th>33</th>\n",
              "      <th>34</th>\n",
              "      <th>35</th>\n",
              "      <th>36</th>\n",
              "      <th>37</th>\n",
              "      <th>38</th>\n",
              "      <th>39</th>\n",
              "      <th>40</th>\n",
              "      <th>...</th>\n",
              "      <th>904</th>\n",
              "      <th>905</th>\n",
              "      <th>906</th>\n",
              "      <th>907</th>\n",
              "      <th>908</th>\n",
              "      <th>909</th>\n",
              "      <th>910</th>\n",
              "      <th>911</th>\n",
              "      <th>912</th>\n",
              "      <th>913</th>\n",
              "      <th>914</th>\n",
              "      <th>915</th>\n",
              "      <th>916</th>\n",
              "      <th>917</th>\n",
              "      <th>918</th>\n",
              "      <th>919</th>\n",
              "      <th>920</th>\n",
              "      <th>921</th>\n",
              "      <th>922</th>\n",
              "      <th>923</th>\n",
              "      <th>924</th>\n",
              "      <th>925</th>\n",
              "      <th>926</th>\n",
              "      <th>927</th>\n",
              "      <th>928</th>\n",
              "      <th>929</th>\n",
              "      <th>930</th>\n",
              "      <th>931</th>\n",
              "      <th>932</th>\n",
              "      <th>933</th>\n",
              "      <th>934</th>\n",
              "      <th>935</th>\n",
              "      <th>936</th>\n",
              "      <th>937</th>\n",
              "      <th>938</th>\n",
              "      <th>939</th>\n",
              "      <th>940</th>\n",
              "      <th>941</th>\n",
              "      <th>942</th>\n",
              "      <th>943</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>movie title</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>'Til There Was You (1997)</th>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>...</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1-900 (1994)</th>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>...</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>101 Dalmatians (1996)</th>\n",
              "      <td>2.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>2.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>2.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>3.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>...</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>2.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>2.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>2.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>12 Angry Men (1957)</th>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>3.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>...</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>5.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>187 (1997)</th>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>2.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>4.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>...</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "      <td>0.0</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>5 rows × 943 columns</p>\n",
              "</div>"
            ],
            "text/plain": [
              "user id                    1    2    3    4    5    ...  939  940  941  942  943\n",
              "movie title                                         ...                         \n",
              "'Til There Was You (1997)  0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0\n",
              "1-900 (1994)               0.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0\n",
              "101 Dalmatians (1996)      2.0  0.0  0.0  0.0  2.0  ...  0.0  0.0  0.0  0.0  0.0\n",
              "12 Angry Men (1957)        5.0  0.0  0.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0\n",
              "187 (1997)                 0.0  0.0  2.0  0.0  0.0  ...  0.0  0.0  0.0  0.0  0.0\n",
              "\n",
              "[5 rows x 943 columns]"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 157
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Y_ZM14b_33S1",
        "outputId": "d915467f-0982-453d-d90c-bb6f52f163be",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 50
        }
      },
      "source": [
        "# transform matrix to scipy sparse matrix\n",
        "movie_to_user_sparse_df = csr_matrix(movie_to_user_df.values)\n",
        "movie_to_user_sparse_df"
      ],
      "execution_count": 158,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "<1664x943 sparse matrix of type '<class 'numpy.float64'>'\n",
              "\twith 99693 stored elements in Compressed Sparse Row format>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 158
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "WrE3OE3xAstv"
      },
      "source": [
        "Extracting movie names into a list:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "C3fjBBBs9tNw",
        "outputId": "b2b9a713-d213-483f-84ce-9af538b806de",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 185
        }
      },
      "source": [
        "movies_list = list(movie_to_user_df.index)\n",
        "movies_list[:10]"
      ],
      "execution_count": 184,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "[\"'Til There Was You (1997)\",\n",
              " '1-900 (1994)',\n",
              " '101 Dalmatians (1996)',\n",
              " '12 Angry Men (1957)',\n",
              " '187 (1997)',\n",
              " '2 Days in the Valley (1996)',\n",
              " '20,000 Leagues Under the Sea (1954)',\n",
              " '2001: A Space Odyssey (1968)',\n",
              " '3 Ninjas: High Noon At Mega Mountain (1998)',\n",
              " '39 Steps, The (1935)']"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 184
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "-t97ADCYAxXy"
      },
      "source": [
        "Creating a dictionary with movie name as key and its index from the list as value:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "5ewuTcPCAdw2",
        "outputId": "b6d31f07-b3e6-4dcb-9e7b-560d48239246",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 54
        }
      },
      "source": [
        "movie_dict = {movie : index for index, movie in enumerate(movies_list)}\n",
        "print(movie_dict)"
      ],
      "execution_count": 186,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "{\"'Til There Was You (1997)\": 0, '1-900 (1994)': 1, '101 Dalmatians (1996)': 2, '12 Angry Men (1957)': 3, '187 (1997)': 4, '2 Days in the Valley (1996)': 5, '20,000 Leagues Under the Sea (1954)': 6, '2001: A Space Odyssey (1968)': 7, '3 Ninjas: High Noon At Mega Mountain (1998)': 8, '39 Steps, The (1935)': 9, '8 1/2 (1963)': 10, '8 Heads in a Duffel Bag (1997)': 11, '8 Seconds (1994)': 12, 'A Chef in Love (1996)': 13, 'Above the Rim (1994)': 14, 'Absolute Power (1997)': 15, 'Abyss, The (1989)': 16, 'Ace Ventura: Pet Detective (1994)': 17,.............., 'You So Crazy (1994)': 1656, 'Young Frankenstein (1974)': 1657, 'Young Guns (1988)': 1658, 'Young Guns II (1990)': 1659, \"Young Poisoner's Handbook, The (1995)\": 1660, 'Zeus and Roxanne (1997)': 1661, 'unknown': 1662, 'Á köldum klaka (Cold Fever) (1994)': 1663}\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "d3o8f5RPLqkY"
      },
      "source": [
        "case_insensitive_movies_list = [i.lower() for i in movies_list]"
      ],
      "execution_count": 211,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "TzI5h6UapJLS"
      },
      "source": [
        "Fitting a KNN model:"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "HH5XdKjBpIsQ",
        "outputId": "937c7c7b-adea-4472-9ea9-d27e09688caf",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 67
        }
      },
      "source": [
        "knn_movie_model = NearestNeighbors(metric='cosine', algorithm='brute')\n",
        "knn_movie_model.fit(movie_to_user_sparse_df)\n"
      ],
      "execution_count": 159,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "NearestNeighbors(algorithm='brute', leaf_size=30, metric='cosine',\n",
              "                 metric_params=None, n_jobs=None, n_neighbors=5, p=2,\n",
              "                 radius=1.0)"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 159
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "yE70fQ9bqGiH"
      },
      "source": [
        "## function to find top n similar users of the given input user \n",
        "def get_similar_movies(movie, n = 10):\n",
        "  ## input to this function is the movie and number of top similar movies you want.\n",
        "  index = movie_dict[movie]\n",
        "  knn_input = np.asarray([movie_to_user_df.values[index]])\n",
        "  n = min(len(movies_list)-1,n)\n",
        "  distances, indices = knn_movie_model.kneighbors(knn_input, n_neighbors=n+1)\n",
        "  \n",
        "  print(\"Top\",n,\"movies which are very much similar to the Movie-\",movie, \"are: \")\n",
        "  print(\" \")\n",
        "  for i in range(1,len(distances[0])):\n",
        "    print(movies_list[indices[0][i]])\n",
        "  \n"
      ],
      "execution_count": 198,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "2swG-7i8VcDh"
      },
      "source": [
        "Testing the recommender system with basic input with the movie names\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "KTElQKhe33Rg",
        "outputId": "44bc712a-096d-4ca2-d099-035cc2c5c7fc",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 302
        }
      },
      "source": [
        "from pprint import pprint\n",
        "movie_name = '101 Dalmatians (1996)'\n",
        "\n",
        "get_similar_movies(movie_name,15)"
      ],
      "execution_count": 199,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Top 15 movies which are very much similar to the Movie- 101 Dalmatians (1996) are: \n",
            " \n",
            "Jack (1996)\n",
            "Twister (1996)\n",
            "Willy Wonka and the Chocolate Factory (1971)\n",
            "Independence Day (ID4) (1996)\n",
            "Toy Story (1995)\n",
            "Father of the Bride Part II (1995)\n",
            "Hunchback of Notre Dame, The (1996)\n",
            "Lion King, The (1994)\n",
            "Mrs. Doubtfire (1993)\n",
            "Jungle Book, The (1994)\n",
            "Grumpier Old Men (1995)\n",
            "Mission: Impossible (1996)\n",
            "Mr. Holland's Opus (1995)\n",
            "Homeward Bound II: Lost in San Francisco (1996)\n",
            "Dragonheart (1996)\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "LIGky82kuQxF"
      },
      "source": [
        "**Dynamically suggesting** movie name from the existing movie corpus we have, based on the user input using try and except architecture."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "eJus19K5VpkG"
      },
      "source": [
        "Defining a function which outputs movie names as suggestion when the user mis spells the movie name. **User might have intended to type any of these movie names.**"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "AXKHWqLVI1w5"
      },
      "source": [
        "# function which takes input and returns suggestions for the user\n",
        "\n",
        "def get_possible_movies(movie):\n",
        "\n",
        "    temp = ''\n",
        "    possible_movies = case_insensitive_movies_list.copy()\n",
        "    for i in movie :\n",
        "      out = []\n",
        "      temp += i\n",
        "      for j in possible_movies:\n",
        "        if temp in j:\n",
        "          out.append(j)\n",
        "      if len(out) == 0:\n",
        "          return possible_movies\n",
        "      out.sort()\n",
        "      possible_movies = out.copy()\n",
        "\n",
        "    return possible_movies"
      ],
      "execution_count": 220,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "UM1yfFMNW-T7"
      },
      "source": [
        "This function provides user with **movie name suggestions if movie name is mis-spelled** or **Recommends similar movies to the input movie** if the movie name is valid."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "TW1wNb-tuOWL"
      },
      "source": [
        "class invalid(Exception):\n",
        "    pass\n",
        "\n",
        "def spell_correction():\n",
        "    \n",
        "    try:\n",
        "\n",
        "      movie_name = input(\"Enter the Movie name: \")\n",
        "      movie_name_lower = movie_name.lower()\n",
        "      if movie_name_lower not in case_insensitive_movies_list :\n",
        "        raise invalid\n",
        "      else :\n",
        "        # movies_list[case_insensitive_country_names.index(movie_name_lower)]\n",
        "        num_recom = int(input(\"Enter Number of movie recommendations needed: \"))\n",
        "        get_similar_movies(movies_list[case_insensitive_movies_list.index(movie_name_lower)],num_recom)\n",
        "\n",
        "    except invalid:\n",
        "\n",
        "      possible_movies = get_possible_movies(movie_name_lower)\n",
        "\n",
        "      if len(possible_movies) == len(movies_list) :\n",
        "        print(\"Movie name entered is does not exist in the list \")\n",
        "      else :\n",
        "        indices = [case_insensitive_movies_list.index(i) for i in possible_movies]\n",
        "        print(\"Entered Movie name is not matching with any movie from the dataset . Please check the below suggestions :\\n\",[movies_list[i] for i in indices])\n",
        "        spell_correction()\n"
      ],
      "execution_count": 223,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "0_J8X0l_33PE",
        "outputId": "0d2f0aaa-fa93-4fd3-a249-8815e5b089b1",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 406
        }
      },
      "source": [
        "spell_correction()"
      ],
      "execution_count": 236,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Enter the Movie name: back\n",
            "Entered Movie name is not matching with any movie from the dataset . Please check the below suggestions :\n",
            " ['Back to the Future (1985)', 'Backbeat (1993)', 'Best of the Best 3: No Turning Back (1995)', 'Empire Strikes Back, The (1980)', 'Hunchback of Notre Dame, The (1996)', 'Switchback (1997)']\n",
            "Enter the Movie name: Empire Strikes Back, The (1980)\n",
            "Enter Number of movie recommendations needed: 15\n",
            "Top 15 movies which are very much similar to the Movie- Empire Strikes Back, The (1980) are: \n",
            " \n",
            "Raiders of the Lost Ark (1981)\n",
            "Indiana Jones and the Last Crusade (1989)\n",
            "Back to the Future (1985)\n",
            "Star Wars (1977)\n",
            "Terminator, The (1984)\n",
            "Return of the Jedi (1983)\n",
            "Terminator 2: Judgment Day (1991)\n",
            "Princess Bride, The (1987)\n",
            "Jurassic Park (1993)\n",
            "Fugitive, The (1993)\n",
            "Silence of the Lambs, The (1991)\n",
            "E.T. the Extra-Terrestrial (1982)\n",
            "Star Trek: The Wrath of Khan (1982)\n",
            "Alien (1979)\n",
            "Blade Runner (1982)\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "nRarT70-aRTg"
      },
      "source": [
        "Observation on above built KNN Recommender System:\n",
        "\n",
        "An interesting observation would be that the above KNN model for movies recommends movies that are produced in very similar years of the input movie. However, the cosine distance of all those recommendations are observed to be actually quite small. This might be because there are too many zero values in our movie-user matrix. With too many zero values in our data, the data sparsity becomes a real issue for KNN model and the distance in KNN model starts to fall apart. So I'd like to dig deeper and look closer inside our data."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "fi1AOjkPaWAp"
      },
      "source": [
        "\n",
        "Let's now look at how sparse the movie-user matrix is by calculating percentage of zero values in the data."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "MK0JWPnQ33My",
        "outputId": "484bff9d-cc8f-4b7a-a227-a33967d12bbe",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "# calcuate total number of entries in the movie-user matrix\n",
        "num_entries = movie_to_user_df.shape[0] * movie_to_user_df.shape[1]\n",
        "# calculate total number of entries with zero values\n",
        "num_zeros = (movie_to_user_df==0).sum(axis=1).sum()\n",
        "# calculate ratio of number of zeros to number of entries\n",
        "ratio_zeros = num_zeros / num_entries\n",
        "print('There is about {:.2%} of ratings in our data is missing'.format(ratio_zeros))"
      ],
      "execution_count": 228,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "There is about 93.65% of ratings in our data is missing\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "_xe7IF4LiWLv"
      },
      "source": [
        "This result confirms the above hypothesis. The vast majority of entries in our data is zero. This explains why the distance between similar items or opposite items are both pretty large.\n",
        "\n",
        "So, lets try out deep learning models and Natural Language Processing techniques in the next segment of this project."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "cpybAavhiz41"
      },
      "source": [
        ""
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "jVJu1rsTx0F3"
      },
      "source": [
        "# Rough Work"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ZZXpqM8lhzoe",
        "outputId": "c5310c5c-4d59-4d7a-ceb0-e7ac5ca19709",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "d = np.asarray([2,4,4,8,2])\n",
        "d = d/np.sum(d)\n",
        "d"
      ],
      "execution_count": 119,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "array([0.1, 0.2, 0.2, 0.4, 0.1])"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 119
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ayT0tFP1iSvt",
        "outputId": "a5f9bb70-506f-4e88-e0e2-02debadc1ac1",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 101
        }
      },
      "source": [
        "e = np.asarray([[10,20,30],[30,40,20],[50,30,10],[40,30,10],[30,20,50]])\n",
        "e"
      ],
      "execution_count": 120,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "array([[10, 20, 30],\n",
              "       [30, 40, 20],\n",
              "       [50, 30, 10],\n",
              "       [40, 30, 10],\n",
              "       [30, 20, 50]])"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 120
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "8F95Ey9HtclY",
        "outputId": "aff99e60-ab97-4b6e-8c06-9da136c2a103",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 84
        }
      },
      "source": [
        "x = np.arange(4)\n",
        "xx = x.reshape(4,1)\n",
        "y = np.ones(5)\n",
        "xx+y, y.shape, xx.shape"
      ],
      "execution_count": 116,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "(array([[1., 1., 1., 1., 1.],\n",
              "        [2., 2., 2., 2., 2.],\n",
              "        [3., 3., 3., 3., 3.],\n",
              "        [4., 4., 4., 4., 4.]]), (5,), (4, 1))"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 116
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "xLyZGIO3wmjM",
        "outputId": "6f8b3e74-7a85-4cc2-e9ea-a42547a4906d",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 101
        }
      },
      "source": [
        "d = d[:,np.newaxis] + np.zeros(3)\n",
        "d"
      ],
      "execution_count": 121,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "array([[0.1, 0.1, 0.1],\n",
              "       [0.2, 0.2, 0.2],\n",
              "       [0.2, 0.2, 0.2],\n",
              "       [0.4, 0.4, 0.4],\n",
              "       [0.1, 0.1, 0.1]])"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 121
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "5SSmgMawwwUf",
        "outputId": "6f77c167-f3a5-4f9d-efd4-d2b479e5df8a",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 101
        }
      },
      "source": [
        "f = d * e\n",
        "f"
      ],
      "execution_count": 127,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "array([[ 1.,  2.,  3.],\n",
              "       [ 6.,  8.,  4.],\n",
              "       [10.,  6.,  2.],\n",
              "       [16., 12.,  4.],\n",
              "       [ 3.,  2.,  5.]])"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 127
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "3WvWb8R1xe1B",
        "outputId": "1fe7e6d7-8069-4873-a4fc-c76882084749",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "f.sum(axis=0)"
      ],
      "execution_count": 131,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "array([36., 30., 18.])"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 131
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "wV0Enmh_zEb9",
        "outputId": "02b143b2-d213-451d-bdd1-eaec4d85376a",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "q = e.mean(axis=0)\n",
        "q"
      ],
      "execution_count": 135,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "array([32., 28., 24.])"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 135
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "qmFVYlEuzNt8",
        "outputId": "20061a5d-209f-4349-fd77-7a79ecfbe38a",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "l = np.asarray([3,7,1,2,8,9,3])\n",
        "np.argsort(l)[::-1][:4]"
      ],
      "execution_count": 157,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "array([5, 4, 1, 6])"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 157
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "8AsMXObq3V_w",
        "outputId": "7535e81d-ad16-4537-e6e6-268ab0c7b091",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 50
        }
      },
      "source": [
        "p = np.asarray([3,6,2,8,1,0,6,2,6,0,7,9,5,0])\n",
        "np.argsort(p)[::-1], np.sort(p)[::-1]"
      ],
      "execution_count": 97,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "(array([11,  3, 10,  8,  6,  1, 12,  0,  7,  2,  4, 13,  9,  5]),\n",
              " array([9, 8, 7, 6, 6, 6, 5, 3, 2, 2, 1, 0, 0, 0]))"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 97
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "mOR0d1_Llq5m",
        "outputId": "d0200f5e-a76f-4f36-f4e4-f5079ca7cdfa",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "# list(p)[::-1].index(0)\n",
        "j = np.where(p == 0)[0][-1]\n",
        "j"
      ],
      "execution_count": 98,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "13"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 98
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ZopTiksUnhPl",
        "outputId": "e7b8a57b-5cab-49a7-cd61-8e0377fac752",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "j = np.where(p == 0)[0][-1]\n",
        "h = np.argsort(p)[::-1]\n",
        "h[:list(h).index(j)]"
      ],
      "execution_count": 99,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "array([11,  3, 10,  8,  6,  1, 12,  0,  7,  2,  4])"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 99
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "vgMQdXL-u43G",
        "outputId": "123edaf0-d199-4ed2-c1ce-c19acc0cfe1d",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 118
        }
      },
      "source": [
        "f = 'rohith kumar 346'\n",
        "i = ['hit','ro','rohi','34',' ','itho','ohit']\n",
        "\n",
        "for j in i:\n",
        "  if j in f:\n",
        "    print(j)"
      ],
      "execution_count": 204,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "hit\n",
            "ro\n",
            "rohi\n",
            "34\n",
            " \n",
            "ohit\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "T_3krmlmMSjl",
        "outputId": "917c6eed-3f31-4901-a084-9598bd0169e8",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "d = [2,3,76,4,7,1]\n",
        "e = [3,1,7,2]\n",
        "[d.index(i) for i in e]"
      ],
      "execution_count": 208,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "[1, 5, 4, 0]"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 208
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "_DgLG9Y0Tt6A"
      },
      "source": [
        ""
      ],
      "execution_count": null,
      "outputs": []
    }
  ]
}
